<% if comment.user -%>
<% is_teacher = comment.user.teacher? -%>
<% login_link = link_to( comment.user.login , {:controller => "user_profile" ,:action=>"index",:id => comment.user },:class=>"profile_link") -%>
<% else -%>
<% is_teacher = false -%>
<% login_link = 'unknown' -%>
<% end -%>
<p class="comment_footer" >posted by <%= login_link %>, <%= comment.created_at_formatted %>
<% if can_edit_comment?(comment) %>   
    <%= link_to_remote 'Edit', {:update => "comment_#{comment.id}",
        :after => "insertWaitingImg('comment_#{comment.id}')",
        :url => {:controller => "comments", :action => "edit" , :id => comment.id }},{:class => 'add_link'}  %>    
    <%= link_to_remote 'Delete', {:update => "comments",
        :after => "insertWaitingImg('comments')",
        :url => {:controller => "comments", :action => "destroy" , :id => comment.id, :commentable_id => @commentable.id, :commentable_type => @commentable.class },:confirm => 'Are you sure?'},{:class => 'add_link'}  %> 
<% end %>
</p>
<p class="<%= is_teacher ? 'comment_teacher' : 'comment_user' %>"><%= (h comment.content).gsub(/[\n]/, "<br />")  %></p>
